﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using DBUnitility;
using System.Data;
using System.Data.SqlClient;
namespace DAL
{
    public class OrderListService
    {
        public List<OrderList> GetAllOrderList()
        {
            string sql = "select ID,CMD,CMDName,CMDData from OrderList";
            List<OrderList> list = new List<OrderList>();
            SqlDataReader objReader = SQLHelper.GetReader(sql);
            while (objReader.Read())
            {
                list.Add(new OrderList() 
                {
                    ID = Convert.ToInt32(objReader["ID"]),
                    CMD = Convert.ToInt32(objReader["CMD"]),
                    CMDName = objReader["CMDName"].ToString(),
                    CMDData = Convert.ToInt32(objReader["CMDData"])
                });
            }
            objReader.Close();//关闭连接
            return list;
        }
    }
}
